From 000d7a68d1ea383d6cca7dcfb88ebcbb3c54190a Mon Sep 17 00:00:00 2001 From: Justin Burkett Date: Sat, 27 May 2017 15:34:54 -0400 Subject: [PATCH] Handle C-h when buffer not showing which-key-C-h-dispatch was not doing anything different if the which-key buffer was not showing. This makes it fall back to the standard Emacs behavior. Fixes #172 --- which-key.el | 56 +++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/which-key.el b/which-key.el index 137ab41d1e2..ab3b3e1dea4 100644 --- a/which-key.el +++ b/which-key.el @@ -2056,34 +2056,36 @@ after first page." `which-key-C-h-map'. This command is always accessible (from any prefix) if `which-key-use-C-h-commands' is non nil." (interactive) - (let* ((prefix-keys (key-description which-key--current-prefix)) - (full-prefix (which-key--full-prefix prefix-keys current-prefix-arg t)) - (prompt (concat (when (string-equal prefix-keys "") + (if (not (which-key--popup-showing-p)) + (which-key-show-standard-help) + (let* ((prefix-keys (key-description which-key--current-prefix)) + (full-prefix (which-key--full-prefix prefix-keys current-prefix-arg t)) + (prompt (concat (when (string-equal prefix-keys "") + (propertize + (concat " " + (or which-key--current-show-keymap-name + "Top-level bindings")) + 'face 'which-key-note-face)) + full-prefix (propertize - (concat " " - (or which-key--current-show-keymap-name - "Top-level bindings")) - 'face 'which-key-note-face)) - full-prefix - (propertize - (substitute-command-keys - (concat - " \\" - " \\[which-key-show-next-page-cycle]" - which-key-separator "next-page," - " \\[which-key-show-previous-page-cycle]" - which-key-separator "previous-page," - " \\[which-key-undo-key]" - which-key-separator "undo-key," - " \\[which-key-show-standard-help]" - which-key-separator "help," - " \\[which-key-abort]" - which-key-separator "abort")) - 'face 'which-key-note-face))) - (key (string (read-key prompt))) - (cmd (lookup-key which-key-C-h-map key)) - (which-key-inhibit t)) - (if cmd (funcall cmd) (which-key-turn-page 0)))) + (substitute-command-keys + (concat + " \\" + " \\[which-key-show-next-page-cycle]" + which-key-separator "next-page," + " \\[which-key-show-previous-page-cycle]" + which-key-separator "previous-page," + " \\[which-key-undo-key]" + which-key-separator "undo-key," + " \\[which-key-show-standard-help]" + which-key-separator "help," + " \\[which-key-abort]" + which-key-separator "abort")) + 'face 'which-key-note-face))) + (key (string (read-key prompt))) + (cmd (lookup-key which-key-C-h-map key)) + (which-key-inhibit t)) + (if cmd (funcall cmd) (which-key-turn-page 0))))) ;;; Update -- 2.30.2